<?php
	class Message_model extends CI_Model
	{
		function __construct()
		{
			// Call the Model constructor
			parent::__construct();
		}
		
		public function get_message( $messageID )
		{
			$query = $this->db->get_where('ThreadMessage', array('MessageID' => $messageID));
			$toReturn = $query->result_array();
			return $toReturn[0];
		}
		
		public function get_all( )
		{
			$query = $this->db->get('ThreadMessage');
			return $query->result_array();
		}
		
		public function get_thread_messages( $threadID )
		{
			$query = $this->db->get_where( 'ThreadMessage', array( 'Thread' => $threadID) );
			return $query->result_array();
		}
		
		public function add_message( $fields )
		{
			$this->db->insert('ThreadMessage', $fields);
		}
	}
?>